home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / shells / scsh-0.4 / scsh-0 / scsh-0.4.2 / configure.in < prev    next >
Text File  |  1995-11-04  |  9KB  |  359 lines

  1. dnl Process this file with autoconf 2.x to produce a configure script.
  2.  
  3. dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  4. dnl Autoconf does not seems to fit the needs of dynamic linking well -bri
  5.  
  6. dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  7. dnl We might want AC_CHAR_UNSIGNED in the future.
  8.  
  9. dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  10. dnl The -cckr (K&R) flag is for the IRIX C compiler.  If this is left
  11. dnl out, scheme48vm.c breaks because the rather pedantic SGI compiler
  12. dnl decides that a char is not the same thing as an unsigned char.
  13. dnl - Bryan O'Sullivan 3/94
  14.  
  15. AC_DEFUN(S48_CFLAG_CKR, [
  16.   AC_MSG_CHECKING(${CC} for -cckr)
  17.   AC_CACHE_VAL(s48_cv_cflag_ckr,[
  18.     if test ${CC} != gcc; then
  19.       echo "main(){int i=1;}" > conftest.c
  20.       if CFLAGS="-cckr ${CFLAGS}" eval $ac_compile
  21.       then
  22.         s48_cv_cflag_ckr=yes
  23.       else
  24.         s48_cv_cflag_ckr=no
  25.       fi
  26.     else
  27.       s48_cv_cflag_ckr=no
  28.     fi
  29.     rm -f conftest*])
  30.   AC_MSG_RESULT($s48_cv_cflag_ckr)
  31.   if test $s48_cv_cflag_ckr = yes; then
  32.     CFLAGS=$CFLAGS
  33.   fi
  34. ])
  35.  
  36. dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  37. AC_DEFUN(S48_POSIX_LIBC, [
  38.   AC_MSG_CHECKING(for RISC/OS POSIX library lossage)
  39.   AC_CACHE_VAL(s48_cv_posix_libc,[
  40.     if test -f /usr/posix/usr/lib/libc.a; then
  41.       s48_cv_posix_libc=yes
  42.     else
  43.       s48_cv_posix_libc=no
  44.     fi])
  45.   AC_MSG_RESULT($s48_cv_posix_libc)
  46.   if test $s48_cv_posix_libc = yes; then
  47.     LIBS="${LIBS} /usr/posix/usr/lib/libc.a"
  48.   fi
  49. ])
  50.  
  51. dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  52. AC_DEFUN(S48_CFLAG_O2, [
  53.   AC_MSG_CHECKING(whether we can use -O2)
  54.   AC_CACHE_VAL(s48_cv_cflag_o2,[
  55.     if test "z$CFLAGS" = "z"; then 
  56.       if test "z$GCC" = "z"; then 
  57.         s48_cv_cflag_o2=yes
  58.       else 
  59.         s48_cv_cflag_o2=no
  60.       fi
  61.     else
  62.       s48_cv_cflag_o2=preset
  63.     fi])
  64.   AC_MSG_RESULT($s48_cv_cflag_o2)
  65.   case "$s48_cv_cflag_o2" in
  66.     yes )
  67.       CFLAGS="-O"
  68.     ;;
  69.     no )
  70.       CFLAGS="-O2 -g"
  71.     ;;
  72.   esac
  73. ])
  74.  
  75. dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  76. AC_DEFUN(S48_USCORE, [
  77.   AC_MSG_CHECKING(for underscore before symbols)
  78.   AC_CACHE_VAL(s48_cv_uscore,[
  79.     echo "main(){int i=1;}
  80.     fnord(){int i=23; int ltuae=42;}" > conftest.c
  81.     ${CC} conftest.c > /dev/null
  82.     if (nm a.out | grep _fnord) > /dev/null; then
  83.       s48_cv_uscore=yes
  84.     else
  85.       s48_cv_uscore=no
  86.     fi])
  87.   AC_MSG_RESULT($s48_cv_uscore)
  88.   if test $s48_cv_uscore = yes; then
  89.     AC_DEFINE(USCORE)
  90.   fi
  91.   rm -f conftest.c a.out
  92. ])
  93.  
  94. dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  95. AC_DEFUN(S48_NLIST,[
  96.   AC_MSG_CHECKING(for n_name)
  97.   AC_CACHE_VAL(s48_cv_nlist,[
  98.     AC_TRY_COMPILE([#include <nlist.h>], 
  99.                    [struct nlist name_list;
  100.                     name_list.n_name = "foo";],
  101.                    s48_cv_nlist=yes,
  102.                    s48_cv_nlist=no)])
  103.   AC_MSG_RESULT($s48_cv_nlist)
  104.   if test $s48_cv_nlist = yes; then
  105.     AC_DEFINE(NLIST_HAS_N_NAME)
  106.   fi
  107. ])
  108.  
  109. dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  110. AC_DEFUN(S48__CNT,[
  111.   AC_MSG_CHECKING(for _cnt)
  112.   AC_CACHE_VAL(s48_cv__cnt,[
  113.     AC_TRY_COMPILE([#include <stdio.h>], 
  114.                    [return stdin->_cnt;],
  115.                    s48_cv__cnt=yes,
  116.                    s48_cv__cnt=no)])
  117.   AC_MSG_RESULT($s48_cv__cnt)
  118.   if test $s48_cv__cnt = yes; then
  119.     AC_DEFINE(FILE_HAS__CNT)
  120.   fi
  121. ])
  122.  
  123. dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  124. AC_DEFUN(SCSH_TZNAME,[
  125.   AC_MSG_CHECKING(for tzname)
  126.   AC_CACHE_VAL(scsh_cv_tzname,[
  127.     AC_TRY_COMPILE([#include <time.h>], 
  128.            [return (int) tzname;],
  129.                    scsh_cv_tzname=yes,
  130.                    scsh_cv_tzname=no)])
  131.   AC_MSG_RESULT($scsh_cv_tzname)
  132.   if test $scsh_cv_tzname = yes; then
  133.     AC_DEFINE(HAVE_TZNAME)
  134.   fi
  135. ])
  136.  
  137. dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  138. AC_DEFUN(SCSH_GMTOFF,[
  139.   AC_MSG_CHECKING(for gmtoff)
  140.   AC_CACHE_VAL(scsh_cv_gmtoff,[
  141.     AC_TRY_COMPILE([#include <time.h>], 
  142.            [struct tm time;
  143.             return time.tm_gmtoff;],
  144.                    scsh_cv_gmtoff=yes,
  145.                    scsh_cv_gmtoff=no)])
  146.   AC_MSG_RESULT($scsh_cv_gmtoff)
  147.   if test $scsh_cv_gmtoff = yes; then
  148.     AC_DEFINE(HAVE_GMTOFF)
  149.   fi
  150. ])
  151.  
  152. dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  153. AC_DEFUN(SCSH_LINUX_ELF, [
  154.   AC_MSG_CHECKING(for Linux using ELF)
  155.   AC_CACHE_VAL(scsh_cv_linux_elf,[
  156.     touch conftest.c
  157.     if ${CC} -v conftest.c 2>&1 | grep -q __ELF__ ; then
  158.       scsh_cv_linux_elf=yes
  159.     else
  160.       scsh_cv_linux_elf=no
  161.     fi])
  162.   AC_MSG_RESULT($scsh_cv_linux_elf)
  163.   if test $scsh_cv_linux_elf = yes; then
  164.     LDFLAGS=-rdynamic
  165.   fi
  166.   rm -f conftest.c a.out
  167. ])
  168.  
  169. dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  170. AC_DEFUN(SCSH_LINUX_STATIC_DEBUG, [
  171.   case "$host" in
  172.     *-*-linux* )
  173.     AC_MSG_CHECKING(for broken Linux that needs -static with -g)
  174.     AC_CACHE_VAL(scsh_cv_linux_static_debug,[
  175.       AC_TRY_LINK([],
  176.             [],
  177.             scsh_cv_linux_static_debug=no,
  178.             scsh_cv_linux_static_debug=yes)])
  179.     AC_MSG_RESULT($scsh_cv_linux_static_debug)
  180.     if test $scsh_cv_linux_static_debug = yes; then
  181.       LDFLAGS="-static ${LDFLAGS}"
  182.     fi
  183.   ;;
  184.   esac
  185. ])
  186.  
  187. dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  188. AC_DEFUN(SCSH_CONST_SYS_ERRLIST,[
  189.   AC_MSG_CHECKING(for const sys_errlist)
  190.   AC_CACHE_VAL(scsh_cv_const_sys_errlist,[
  191.     AC_TRY_COMPILE([#include <errno.h>
  192.                     #include <unistd.h>], 
  193.            [const extern char *sys_errlist[];],
  194.                    scsh_cv_const_sys_errlist=yes,
  195.                    scsh_cv_const_sys_errlist=no)])
  196.   AC_MSG_RESULT($scsh_cv_const_sys_errlist)
  197.   if test $scsh_cv_const_sys_errlist = yes; then
  198.     AC_DEFINE(HAVE_CONST_SYS_ERRLIST)
  199.   fi
  200. ])
  201.  
  202. dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  203. AC_INIT(scheme48vm.c)
  204. AC_CONFIG_HEADER(sysdep.h)
  205.  
  206. AC_CANONICAL_HOST
  207.  
  208. AC_PROG_CC
  209. AC_ISC_POSIX
  210. SCSH_LINUX_STATIC_DEBUG
  211. AC_PROG_INSTALL
  212. AC_PROG_RANLIB
  213. AC_C_CONST
  214.  
  215. AC_C_BIGENDIAN
  216. if test $ac_cv_c_bigendian = no ; then
  217.   ENDIAN=little
  218. else
  219.   ENDIAN=big
  220. fi
  221.  
  222. AR=${AR-"ar cq"}
  223. TMPDIR=${TMPDIR-"/usr/tmp"}
  224.  
  225. case "$host" in
  226.  
  227.   ## CX/UX
  228.   m88k-harris-cxux* )
  229.     dir=cxux
  230.     CC="cc -Xa"
  231.     CFLAGS="-O"
  232.     LDFLAGS="-O -Wl,-Bexport"
  233.     AC_DEFINE(HAVE_HARRIS)
  234.   ;;
  235.     
  236.   ## DEC Ultrix
  237.   mips-dec-ultrix* )
  238.     dir=ultrix
  239.     if test ${CC} = cc; then
  240.       LDFLAGS=-N
  241.     fi
  242.   ;;
  243.   
  244.   ## HP 9000 series 700 and 800, running HP/UX
  245.   hppa*-hp-hpux* )
  246.     dir=hpux
  247.     if test ${CC} = cc; then
  248.       CFLAGS="-Ae -O +Obb1800"
  249.       AC_DEFINE(_HPUX_SOURCE)
  250.       AC_DEFINE(hpux)
  251.     fi
  252.   ;;
  253.   
  254.   ## IBM AIX
  255.   rs6000-ibm-aix*|powerpc-ibm-aix* )
  256.     dir=aix
  257.     LDFLAGS="-O"
  258.     if test ${CC} = gcc; then
  259.       LDFLAGS_AIX="-Xlinker -bexport:exportlist.aix"
  260.     else
  261.       LDFLAGS_AIX="-bexport:exportlist.aix"
  262.     fi
  263.     CFLAGS="-O"
  264.     AIX_P="exportlist.aix"
  265.   ;;
  266.   
  267.   ## Linux
  268.   *-*-linux* )
  269.     dir=linux
  270.     # gross, but needed for some older a.out systems for 0.4.x
  271.     LIBS=-lc
  272.     SCSH_LINUX_ELF
  273.   ;;
  274.   
  275.   ## NetBSD and FreeBSD ( and maybe 386BSD also)
  276.   *-*-*bsd* )
  277.     dir=bsd
  278.   ;;
  279.   
  280.   ## NeXT
  281.   *-next-* )
  282.     dir=next
  283.     CC="$CC -posix"
  284.     AC_DEFINE(HAVE_SIGACTION)
  285.   ;;
  286.   
  287.   ## SGI IRIX
  288.   mips-sgi-irix* )
  289.     dir=irix
  290.     S48_CFLAG_CKR
  291.     INSTALL='$(srcdir)/install-sh'
  292.   ;;
  293.   
  294.   ## SunOS
  295.   sparc*-sun-sunos* )
  296.    dir=sunos
  297.   ;;
  298.   
  299.   ## Solaris
  300.   sparc*-sun-solaris* )
  301.     dir=solaris
  302.     AC_DEFINE(HAVE_NLIST)
  303.   ;;
  304.   
  305.   ## Generic Configuration
  306.   * )
  307.     dir=generic
  308.     echo "WARNING: "
  309.     echo "WARNING: Using generic configuration."
  310.     echo "WARNING: See doc/install.txt for more information."
  311.     echo "WARNING: "
  312.   ;;
  313. esac
  314.  
  315. /bin/rm -f $srcdir/scsh/machine
  316. ln -s $srcdir/$dir $srcdir/scsh/machine
  317.  
  318. AC_CHECK_LIB(m, sqrt(0.0) + t)
  319. AC_CHECK_LIB(gen, pathfind)
  320. AC_CHECK_LIB(nsl, gethostbyaddr)
  321. AC_CHECK_LIB(socket, socket)
  322. dnl Solaris 2.3 seems to need -lelf for nlist().  (tnx Bryan O'Sullivan)
  323. AC_CHECK_LIB(elf, nlist)
  324. AC_CHECK_LIB(ld, ldopen)
  325. AC_CHECK_LIB(dl, dlopen)
  326. dnl    AC_CHECK_LIB(mld, main)
  327.  
  328. AC_RETSIGTYPE
  329. AC_HAVE_HEADERS(libgen.h sys/timeb.h posix/time.h sys/select.h)
  330. AC_HAVE_FUNCS(strerror)
  331. AC_HAVE_FUNCS(dlopen gettimeofday ftime nlist select setitimer sigaction)
  332. AC_HAVE_FUNCS(socket chroot)
  333.  
  334. S48_POSIX_LIBC
  335. S48_CFLAG_O2
  336. S48_USCORE
  337. S48_NLIST
  338. S48__CNT
  339.  
  340. SCSH_TZNAME
  341. SCSH_GMTOFF
  342. SCSH_CONST_SYS_ERRLIST
  343.  
  344. CFLAGS1=${CFLAGS}
  345.  
  346. AC_SUBST(AIX_P)
  347. AC_SUBST(AR)
  348. AC_SUBST(CC)
  349. AC_SUBST(CFLAGS)
  350. AC_SUBST(CFLAGS1)
  351. AC_SUBST(ENDIAN)
  352. AC_SUBST(LDFLAGS)
  353. AC_SUBST(LDFLAGS_AIX)
  354. AC_SUBST(LIBS)
  355. AC_SUBST(TMPDIR)
  356.  
  357. AC_OUTPUT(Makefile scsh/regexp/Makefile scsh/endian.scm scsh/static.scm)
  358. chmod +x scsh/static.scm
  359.